// pages/incomeDetail/incomeDetail.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    selectType: 1,
    incomeTotal: 921.70,
    expenditureTotal: 2180.00,
    list: [{
        name: '鱼获结算到账',
        type: 2,
        time: '2024-07-29 12:44',
        total: '1860.00',
        num: 311.0
      },
      {
        name: '购买鱼票',
        type: 3,
        time: '2024-07-29 12:44',
        total: '1672.00',
        num: 532.0
      },
      {
        name: '购买鱼票',
        type: 4,
        time: '2024-07-29 12:44',
        total: '1672.00',
        num: 532.0
      },
      {
        name: '购买鱼票',
        type: 2,
        time: '2024-07-29 12:44',
        total: '1672.00',
        num: 532.0
      },
      {
        name: '购买鱼票',
        type: 3,
        time: '2024-07-29 12:44',
        total: '1672.00',
        num: 532.0
      },
      {
        name: '购买鱼票',
        type: 4,
        time: '2024-07-29 12:44',
        total: '1672.00',
        num: 532.0
      },
      {
        name: '购买鱼票',
        type: 2,
        time: '2024-07-29 12:44',
        total: '1672.00',
        num: 532.0
      },
      {
        name: '购买鱼票',
        type: 3,
        time: '2024-07-29 12:44',
        total: '1672.00',
        num: 532.0
      },
      {
        name: '购买鱼票',
        type: 4,
        time: '2024-07-29 12:44',
        total: '1672.00',
        num: 532.0
      },
      {
        name: '购买鱼票',
        type: 2,
        time: '2024-07-29 12:44',
        total: '1672.00',
        num: 532.0
      },
      {
        name: '购买鱼票',
        type: 3,
        time: '2024-07-29 12:44',
        total: '1672.00',
        num: 532.0
      },
      {
        name: '购买鱼票',
        type: 3,
        time: '2024-07-29 12:44',
        total: '1672.00',
        num: 532.0
      },
      {
        name: '购买鱼票',
        type: 4,
        time: '2024-07-29 12:44',
        total: '1672.00',
        num: 532.0
      },
      {
        name: '购买鱼票',
        type: 2,
        time: '2024-07-29 12:44',
        total: '1672.00',
        num: 532.0
      },
      {
        name: '购买鱼票',
        type: 3,
        time: '2024-07-29 12:44',
        total: '1672.00',
        num: 532.0
      }
    ],
    startDate: '',
    endDate: '',
    tabArr: [{
        id: 1,
        name: '全部'
      },
      {
        id: 2,
        name: '待审核'
      },
      {
        id: 3,
        name: '已通过'
      },
      {
        id: 4,
        name: '审核失败'
      }
    ],
    startDateVisible:false,
    endDateVisible:false
  },
  clickTab(e) {
    let id = e.currentTarget.dataset.typeid
    this.setData({
      selectType: id
    })
  },

  showStartDate() {
    this.setData({
      startDateVisible: true
    })
  },
  showEndDate() {
    this.setData({
      endDateVisible: true
    })
  },
  onClose({ detail }) {
    console.log(detail.trigger);
  },

  handleStartDate(e){
    const { value } = e.detail;
      const format = (val) => {
        const date = new Date(val);
        return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`;
      };

      this.setData({
        startDate: format(value),
      });
  },
  handleEndDate(e){
    const { value } = e.detail;
      const format = (val) => {
        const date = new Date(val);
        return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`;
      };

      this.setData({
        endDate: format(value),
      });
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})